<template>
  <div class="app-container">
    <el-table :data="dataList" v-loading="loading">
      <el-table-column label="序号" type="index" width="55" />
      <el-table-column label="采集时间" prop="collectTime" />
      <el-table-column label="运行模式">
        <template slot-scope="scope">
          {{ runModeStatus(scope.row.data.RunMode) }}
        </template>
      </el-table-column>
      <el-table-column label="破损份额">
        <template slot-scope="scope">
          {{ scope.row.data.DamagePercent }}%
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList()"
    />
  </div>
</template>

<script>
import { listReactorCore } from "@/api/emergency/KDFacility";
export default {
  name: "carrReactor",
  data() {
    return {
      coreState: {},
      dataList: [],
      total: 0,
      loading: true,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        isAsc: "descending",
        orderByColumn: "collectTime",
      },
    };
  },
  props: {
    facId: {
      type: Number,
      default: 2,
    },
  },
  created() {
    this.getList();
  },
  methods: {
    async getList() {
      // this.loading = true;
      // this.queryParams.facilityId = this.facId.toString();
      this.$axios
        .get("/static/emergency/reactor/listReactorCore.json")
        .then((res) => {
          // await listReactorCore(this.queryParams).then((res) => {
          this.loading = false;
          if (res.data.code == 200) {
            this.dataList = res.data.rows;
            this.total = res.data.total;
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    runModeStatus(key) {
      console.log(key);
      switch (Number(key)) {
        case 0:
          return "安全";
          break; // 安全
        case 1:
          return "仅有破损";
          break; // 仅有破损
        case 2:
          return "仅有过热";
          break; // 仅有过热
        case 3:
          return "有破损/有过热";
          break; // 有破损/有过热
        default:
          return "状态不明";
          break; // 状态不明
      }
    },
  },
};
</script>

<style scoped>
</style>
